package com.app.framework.config;

import jakarta.annotation.Resource;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


/**
 * 资源映射Config
 */
@Configuration
public class ResourceConfig implements WebMvcConfigurer {

    @Resource
    private UploadConfig uploadConfig;

    /**
     * 上传映射
     */
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/file/**").addResourceLocations("file:" + uploadConfig.getFileRoot() + "/");
    }

}